from model import Model, Dao
    
class Item(Model):
    def __init__(self, _dict):
        Model.__init__(self, _dict)

        self.name = _dict['name']
        self.description = _dict['description']
        self.price = _dict['price']

        # associate fields
        self.company = _dict['company']

    def __repr__(self):
        return '<Item %r>' % (self.name)

class ItemDao(Dao):
    def __init__(self):
        Dao.__init__(self, Item)
        self.collection = 'items'
        
        # associates { field name : collection name }
        self.ref_collections = {'company':'companies'}

if __name__ == '__main__':
    # create table
    #db.drop_all()
    #db.create_all()
    pass